package com.hava.contentsale.dao;

import com.hava.contentsale.meta.TransactionRecordPO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by zhanpeng on 11/11/2016.
 */
public interface TransactionRecordDao {

    @Select("SELECT * FROM trx")
    public List<TransactionRecordPO> findAll();

    @Select("SELECT * FROM trx WHERE(id = #{param1})")
    public TransactionRecordPO findOne(Long id);

    @Options(useGeneratedKeys=true,keyProperty = "id")
    @Insert("INSERT INTO trx (contentId,personId,price,time) VALUES (#{contentId},#{personId},#{price},#{time})")
    public void create(TransactionRecordPO tr);

    @Update("UPDATE trx SET contentId=#{contentId},personId=#{personId},price=#{price},time=#{time} WHERE (id = #{id})")
    public void update(TransactionRecordPO tr);

    @Delete("DELETE FROM trx WHERE(id = #{param1})")
    public void delete(Long id);
}
